package com.qili.service.exam.impl;

import com.qili.base.mapper.BaseMapper;
import com.qili.base.service.impl.BaseServiceImpl;
import com.qili.entity.exam.ExPaper;
import com.qili.entity.exam.ExQuestion;
import com.qili.entity.exam.ExTree;
import com.qili.entity.exam.dto.ExPaperDTO;
import com.qili.entity.exam.dto.ExQuestionDTO;
import com.qili.mapper.exam.ExPaperMapper;
import com.qili.service.exam.ExPaperService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * @author zhangshuo
 * @date 2021-05-08
 */
@Service
public class ExPaperServiceImpl extends BaseServiceImpl<ExPaper, String> implements ExPaperService {

    @Autowired
    ExPaperMapper exPaperMapper;

    @Override
    public BaseMapper<ExPaper, String> getMappser() {
        return exPaperMapper;
    }

    @Override
    public List<ExTree> selectTree(ExTree tree) {
        return exPaperMapper.selectTree(tree);
    }

    @Override
    public List<ExTree> selectTrees(ExTree tree) {
        return exPaperMapper.selectTrees(tree);
    }

    @Override
    public int updateTree(Map map) {
        return exPaperMapper.updateTree(map);
    }

    @Override
    public List<ExQuestion> stList(String str) {
        return exPaperMapper.stList(str);
    }

    @Override
    public List<ExQuestion> stListByType(ExQuestionDTO exQuestionDTO) {
        return exPaperMapper.stListByType(exQuestionDTO);
    }

    @Override
    public List<String> insertPaperSj(ExPaperDTO exPaperDTO) {
        return exPaperMapper.insertPaperSj(exPaperDTO);
    }

    @Override
    public List<ExPaper> selectExQuestion(ExPaperDTO dto) {
        return exPaperMapper.select(dto);
    }

    @Override
    public List<ExPaper> selectExPaper(ExPaperDTO dto) {
        return exPaperMapper.selectExPaperList(dto);
    }

    @Override
    public List<ExPaper> selectRecycle(ExPaper dto) {
        return exPaperMapper.selectRecycle(dto);
    }

    @Override
    public int deleteSjs(Map map) {
        return exPaperMapper.deleteSjs(map);
    }

    @Override
    public Integer refreshTotalScore(String paperId) {
        return exPaperMapper.refreshTotalScore(paperId);
    }

    @Override
    public int updateBatchPaperStatus(String[] ids) {
        return exPaperMapper.updateBatchPaperStatus(ids);
    }

    @Override
    public int deleteSt(Map map) {
        return exPaperMapper.deleteSt(map);
    }

    @Override
    public int insertTree(Map map) {
        return exPaperMapper.insertTree(map);
    }

    @Override
    public Integer refreshTotalNum(String paperId) {
        return exPaperMapper.refreshTotalNum(paperId);
    }

    @Override
    public Map<String, Object> selectPaperQuCountById(String paperId) {
        return exPaperMapper.selectPaperQuCountById(paperId);
    }

    @Override
    public List<Map<String, Object>> selectRandomSt(ExPaperDTO exPaperDTO) {
        return exPaperMapper.selectRandomSt(exPaperDTO);
    }

    @Override
    public int refreshQuestionSjCanUse(ExQuestion exQuestion, String[] quIds) {
        Integer count = exPaperMapper.selectQuestionSjCanUse(exQuestion, quIds);
        if (count == null) {
            return 0;
        }else {
            return count;
        }
    }

    @Override
    public int delFormRecycle(String paperId) {
        return exPaperMapper.delFormRecycle(paperId);
    }

    @Override
    public int deleteFromRecycle(String[] ids) {
        return exPaperMapper.deleteFromRecycle(ids);
    }

    @Override
    public int hyAll(String[] ids) {
        return exPaperMapper.hyAll(ids);
    }

    @Override
    public List<ExTree> selectSubordinateTrees(String id, String groupid) {
        return exPaperMapper.selectSubordinateTrees(id,groupid);
    }

    @Override
    public void deleteSjsN(Map<String, Object> map) {
        exPaperMapper.deleteSjsN(map);
    }

    @Override
    public void hyAllN(String id, String type) {
        exPaperMapper.hyAllN(id, type);
    }

    @Override
    public List<ExTree> selectTreesByType(ExTree tree, String type) {
        return exPaperMapper.selectTreesByType(tree,type);
    }
}
